package itsm.isperp.report.paser;

import itsm.isperp.framework.data.dialect.DialectFactory;

import org.springframework.data.jdbc.support.DatabaseType;

/**
 * 
 * 
 * 
 * @author lizx
 * @date 2015-12-3
 * @since 1.0
 * 
 */
public class DateQueryPaser {

	public static StringBuilder parse(String dateColumn, String sd, String ed) {
		StringBuilder sb = new StringBuilder();
		if (DialectFactory.getDatabaseType() == DatabaseType.ORACLE) {
			sb.append("  AND (" + dateColumn + "  BETWEEN to_date('" + sd
					+ "','yyyy-MM-dd') AND  to_date('" + ed
					+ " 23:59','yyyy-MM-dd hh24:mi')) ");
		} else {
			sb.append("  AND (" + dateColumn + "  BETWEEN '" + sd + "'  AND  '"
					+ ed + " 23:59') ");
		}

		return sb;

	}

}
